using System;
using System.IO;

namespace UI.Infrastructure.Pictures
{
    public class PictureRepository : IPictureRepository
    {
        private readonly string _imageFolder;

        public PictureRepository() : this("~/images/pets")
        {
        }

        public PictureRepository(string imageFolder)
        {
            if (imageFolder == null) throw new ArgumentNullException("imageFolder");
            _imageFolder = imageFolder;
        }

        #region IPictureRepository Members

        public string GetPictureFileNameForProduct(string productId)
        {
            string fileName = ProductPictures.Current.GetPictureFileNameForProduct(productId);
            return Path.Combine(_imageFolder, fileName);
        }

        #endregion
    }
}